using Mathmall.Administration.Mapper;
using Mathmall.Administration.Models;

namespace Mathmall.Administration.Service.impl;

public class AttrAttrGroupRelationService : IAttrAttrGroupRelationService
{
    private readonly AttrAttrGroupRelationMapper _attrGroupRelationMapper;

    public AttrAttrGroupRelationService(AttrAttrGroupRelationMapper attrGroupRelationMapper)
    {
        _attrGroupRelationMapper = attrGroupRelationMapper;
    }

    /// <summary>
    /// 保存属性和属性分组的关联关系
    /// </summary>
    /// <param name="attrGroupRelation"></param>
    /// <returns></returns>
    public async Task<int> AddAttrAttrGroupRelation(AttrAttrgroupRelation attrGroupRelation)
    {
        return await _attrGroupRelationMapper.addAttrAttrGroupRelation(attrGroupRelation);
    }

    /// <summary>
    /// 更新属性和分组的关联关系
    /// </summary>
    /// <param name="attrAttrgroupRelation"></param>
    /// <returns></returns>
    public async Task<int> UpdateAttrAttrGroupRelation(AttrAttrgroupRelation attrAttrgroupRelation)
    {
        return await _attrGroupRelationMapper.UpdateAttrAttrGroupRelation(attrAttrgroupRelation);
    }

    /// <summary>
    /// 删除属性与分组的关联关系
    /// </summary>
    /// <param name="attrIds"></param>
    /// <returns></returns>
    public async Task<int> DeleteAttrAttrGroupRelation(List<int> attrIds)
    {
       return await _attrGroupRelationMapper.DeleteAttrAttrGroupRelation(attrIds);
    }
}